def is_prime(num):
    if num < 2:
        return False
    for i in range(2, int(num ** 0.5) + 1):
        if num % i == 0:
            return False
    return True

def is_hyperprime(num):
    num_str = str(num)
    if not is_prime(num):
        return 'No'
    for i in range(1, len(num_str)):
        if not is_prime(int(num_str[:-i])):
            return 'No'
    return 'Yes'

F = int(input())
print(is_hyperprime(F))

